<template>
	<view class="hotelcard-box" v-if="dataList" :style="{'--color':vuex_config.themeColor1}">
		<view class="card-box" v-for="(item, index) in dataList" :key="index" @click="openDetail(item)">
			<view class="card-box-img"><image mode="aspectFill" class="img" :src="item.poster_url || ''" lazy-load></image></view>
			<view class="card-box-details">
				<view class="details-title">{{ item.name }}</view>
				<view class="details-location">
					<view class="iconfont iconfont-e768"></view>
					<text class="details-location-title u-line-1">{{ item.address }}</text>
				</view>
				<view class="details-location-classification">
					<view class="classification-box label_border" v-for="(themeItem, themeIndex) in (item.theme || '').split(',')" :key="themeIndex">{{ themeItem }}</view>
				</view>
				<view class="details-price">
					<view class="details-price-left">
						<text class="price-left-icon">￥</text>
						<text class="price-left-price">{{ item.price || 0 }}</text>
						<text class="price-left-icon">起</text>
					</view>
					<view class="details-price-btn">订</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			dataList:{
				type:Array,
				default:[]
			}
		},
		methods:{
			openDetail (item) {
				this.$toProd({...item,prodType:3})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.hotelcard-box {
		background-color: #fff;
		padding: 20rpx 30rpx 10rpx;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	}
	.card-box {
		width: 48%;
		display: flex;
		flex-direction: column;
		border-radius: 8rpx;
		box-shadow: 0px 4px 11px 2px rgba(153, 152, 152, 0.15);
		overflow: hidden;
		margin-bottom: 23rpx;
	}
	.card-box-img {
		width: 100%;
		padding-bottom: 100%;
		position: relative;
		.img {
			position: absolute;
			top: 0;
			left: 0;
		}
	}
	.card-box-details {
		padding: 18rpx 14rpx 20rpx 14rpx;
	}
	.details-title {
		color: #333;
		font-size: 28rpx;
		font-weight: bold;
		font-family: PingFang SC;
	}
	.details-location {
		display: flex;
		align-items: center;
		margin: 15rpx 0;
		.iconfont {
			margin-right: 8rpx;
			color: #666666;
		}
		.details-location-title {
			font-size: 24rpx;
			font-family: PingFang SC;
			color: #666666;
		}
	}
	.details-location-classification {
		display: flex;
		flex-wrap: wrap;
		overflow: hidden;
		height: 38rpx;
		.classification-box {
			background: #ffe3cc;
			padding: 0 10rpx;
			line-height: 36rpx;
			color: var(--color);
			font-size: 20rpx;
			margin: 1rpx 8rpx;
			border-radius: 4rpx;
			position: relative;
			white-space: nowrap;
			text-overflow: ellipsis;
			&.label_border::after{
				border-radius: 10rpx;
			}
		}
	}
	.details-price {
		display: flex;
		align-items: center;
		margin-top: 16rpx;
	}
	.details-price-left {
		flex: 1;
		overflow: hidden;
		.price-left-icon {
			display: inline-block;
			font-size: 24rpx;
			color: #ff1f00;
			font-family: PingFang SC;
		}
		.price-left-price {
			display: inline-block;
			font-size: 36rpx;
			color: #ff1f00;
			margin-right: 4rpx;
			font-weight: bold;
			font-family: PingFang SC;
		}
	}
	.details-price-btn {
		width: 42rpx;
		height: 42rpx;
		border-radius: 50%;
		background-color: #f34d4e;
		color: #fff;
		font-size: 24rpx;
		text-align: center;
		line-height: 42rpx;
		margin-right: 4rpx;
	}
</style>
